package com.example.lizhixin.object_three_team.Fragment;


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.example.lizhixin.object_three_team.Adapter.GameRcdAdapter;
import com.example.lizhixin.object_three_team.Adapter.GameViewAdapter;
import com.example.lizhixin.object_three_team.Base.BaseFragment;
import com.example.lizhixin.object_three_team.Game_frag.ClassifyFragment;
import com.example.lizhixin.object_three_team.Game_frag.ListFragment;
import com.example.lizhixin.object_three_team.Game_frag.NewFragment;
import com.example.lizhixin.object_three_team.Game_frag.OnlineFragment;
import com.example.lizhixin.object_three_team.Game_frag.RecommendFragment;
import com.example.lizhixin.object_three_team.R;
import com.example.lizhixin.object_three_team.Uitls.HttpUtils;
import com.example.lizhixin.object_three_team.Uitls.ThreadUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 */
public class GameFragment extends BaseFragment {


    private ImageView game_xia;
    private Toolbar toolbar;
    private TabLayout game_tabs;
    private ViewPager game_view;
    private static List<String> strtitle = new ArrayList<>();
    private static List<BaseFragment> fragArr = new ArrayList<>();
    private GameViewAdapter viewAdapter;
    public GameFragment() {

    }

    @Override
    protected void initData() {
        Log.e("asd","initData");
        viewAdapter = new GameViewAdapter(getActivity().getSupportFragmentManager());
     strtitle.add("推荐");
     strtitle.add("最新");
     strtitle.add("网游");
     strtitle.add("分类");
     strtitle.add("排行");
     fragArr.add(new RecommendFragment());
     fragArr.add(new NewFragment());
     fragArr.add(new OnlineFragment());
     fragArr.add(new ListFragment());
     fragArr.add(new ClassifyFragment());
     game_tabs.setupWithViewPager(game_view);
     viewAdapter.refrech(fragArr,strtitle);
     game_view.setAdapter(viewAdapter);
     initHttpData();
    }

    private void initHttpData() {

    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.fragment_game;
    }

    @Override
    protected void initView() {
        Log.e("asd","initView");
        game_xia = getActivity().findViewById(R.id.game_xia);
        toolbar = getActivity().findViewById(R.id.toolbar);
        game_tabs = getActivity().findViewById(R.id.game_tabs);
        game_view = getActivity().findViewById(R.id.game_view);
    }

}
